<cpanel include="../../config.php">

<?

/***************************************************************************
 *                                 default.php
 *                            -------------------
 *   Begin                : Thursday, April 16, 2005
 *   Copyright            : (C) 2005 Point and Code
 *   Domain               : http://www.pointandcode.com/
 *   Email                : support@pointandcode.com
 *   Version              : 1.0.0
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 ***************************************************************************/

$html_root_path = '../../';
$page_title = "Default Addresses";
include $root_path.'common.php';
include $root_path.'page_header.php';




$big_wadge_of_stuff = <<<EOFpacman
<cpanel Email="defaultaddress()">
EOFpacman;

// First, get rid of the initial table so the later processes don't get confusticated.
$temp = explode("<table align=left><tr><td>", $big_wadge_of_stuff);
$big_wadge_of_stuff = $temp[1];

//
// Split up into lines...
//
$array_of_defaults_with_junk = array();
$array_of_defaults_with_junk = explode('<br>', $big_wadge_of_stuff);

$array_of_defaults = array();
$i=0;



foreach($array_of_defaults_with_junk as $row) {

	// Get the domain first...
	$temp = explode('<legend><b>', $row);
	$temp2 = explode('</b></legend>', $temp[1]);
	$array_of_defaults[$i]['domain'] = $temp2[0];

	// Then the email address.
	$temp = explode('<tr><td>', $row);
	$temp2 = explode('</td></tr>', $temp[1]);
	$array_of_defaults[$i]['address'] = trim($temp2[0]);

	$i++;
}

$template->set_filenames(array(
	'body' => $root_path.$template_path.'mail/default.tpl')
);

$i = 0;
foreach ($array_of_defaults as $row) {

	if (!empty($row['address'])) {
		$template->assign_block_vars('defaultsrow', array(
			'ROWCLASS' => ($i%2) ? $template_cfg['class_row_1'] : $template_cfg['class_row_2'],
			'DOMAIN' => $row['domain'],
			'ADDRESS' => $row['address'],
			
			'U_EDIT' => 'default_edit.php?address='.$row['address'].'&domain='.$row['domain'],
			)
		);
	$i++;
	}

}

//
// Woohoo! All done!
//
$template->pparse('body');




include $root_path.'page_tail.php';


?>